package com.mcc.myapplication

fun main() {
    val a = 2
    val b = 3
    var max: Int? = null
    if (a > b) {
        max = a
    } else {
        max = b
    }
    // 作为表达式
    max = if (a > b) a else b
    println("max is $max")

    val c = 10
    val maxOrLimit = if (c > a) c else if (a > b) a else b
    println("maxOrLimit is $maxOrLimit")

    // if 表达式的分支可以是代码块，这种情况最后的表达式作为该块的值
    val max2 = if (a > b) {
        print("Choose a,")
        a
    } else {
        print("Choose b,")
        b
    }
    println("max2 is $max2")
}